/*********************************************
This file is part of HIM.

HIM is a module of BCI++ framowork for the implementation of Brain Computer Interface systems.
HIM is intended for use with BCI++ only.

BCI++ is a project of the Sensibilab of Politecnico Di Milano

HIM is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation, either version 3 of 
the License, or (at your option) any later version.

HIM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License
and the GNU Lesser General Public License along with HIM.  
If not, see <http://www.gnu.org/licenses/>.
*************************************************************/

/*!
\file	BCIMessage.h

  \author	Luca Maggi luca.maggi@polimi.it
	\author	Sergio Parini sergio.parini@polimi.it
  
	\date	2008-02-09 creation \n
	2008-10-07 last modification
	
	  \b Org: 
	  SENSIBILAB - Politecnico di Milano
	  
	\b COPYRIGHT: 
	LGPL
*/

#ifndef BCIMESSAGE_INC
#define BCIMESSAGE_INC

//Instrument control
const int	START_ACQ				=	101;
const int	STOP_ACQ				=	102;
const int	CONNECTION_COMPLETED	=	103;

//Triggers event
const int	GRAPH_TRIG				=	201;

//Messages from algorithm to AEnima
const int	CLASSIFICATION			=	301;
const int	FEEDBACK				=	302;
const int	SET_PARAMS				=	303;

//Messagese from AEnima to algorithm
const int	RESET_ALGORITHM			=	401;
const int	REQUEST_PARAMS			=	402;


//Generic messages
const int	BCI_OK					=	501;
const int	BCI_ERROR				=	502;

/*!
Describes the generic message for BCI++
*/
typedef struct BCIMessage
{
	//!Used to define which message you are sending
	int Kind;
	//!Used for single value messages
	int Value;
	//!Storage space for DATA
	int Buffer[16];
	//!Simple integrity chek: MUST BE equal to Kind+Value;
	int Check; 
}BCIMessage;
/*!
Composes a valid BCIMessage
/param Kind		Defines wich kind of message must be sent
/param Value	Defines the value
/param *pBuffer	Pointer to the data buffer that must be sent
/param BuffSize	Size in Bytes of the data that must be copied from /a pBuffer
*/
BCIMessage ComposeMessage(int Kind, int Value = 0, int *pBuffer= 0,int BuffSize = 0);

bool CheckMessage(BCIMessage *pMess);


#endif